| Total Complexity | 6 |
| Total Lines | 61 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import { Entity, Column, PrimaryGeneratedColumn, ManyToOne } from 'typeorm'; |
||
| 3 | |||
| 4 | @Entity() |
||
| 5 | export class BillingItem { |
||
| 6 | @PrimaryGeneratedColumn('uuid') |
||
| 7 | private id: string; |
||
| 8 | |||
| 9 | @Column({type: 'varchar', nullable: false}) |
||
| 10 | private title: string; |
||
| 11 | |||
| 12 | @Column({type: 'integer', nullable: false}) |
||
| 13 | private quantity: number; |
||
| 14 | |||
| 15 | @Column({type: 'integer', nullable: false}) |
||
| 16 | private amount: number; |
||
| 17 | |||
| 18 | @Column({type: 'integer', nullable: true, default: 0}) |
||
| 19 | private discount: number; |
||
| 20 | |||
| 21 | @ManyToOne( |
||
| 22 | type => Billing, |
||
| 23 | billing => billing.items, |
||
| 24 | {nullable: false} |
||
| 25 | ) |
||
| 26 | billing: Billing; |
||
| 27 | |||
| 28 | constructor( |
||
| 29 | billing: Billing, |
||
| 30 | title: string, |
||
| 31 | quantity: number, |
||
| 32 | amount: number, |
||
| 33 | discount?: number |
||
| 34 | ) { |
||
| 35 | this.billing = billing; |
||
| 36 | this.title = title; |
||
| 37 | this.quantity = quantity; |
||
| 38 | this.amount = amount; |
||
| 39 | this.discount = discount; |
||
| 40 | } |
||
| 41 | |||
| 42 | public getId(): string { |
||
| 43 | return this.id; |
||
| 44 | } |
||
| 45 | |||
| 46 | public getTitle(): string { |
||
| 47 | return this.title; |
||
| 48 | } |
||
| 49 | |||
| 50 | public getAmount(): number { |
||
| 51 | return this.amount; |
||
| 52 | } |
||
| 53 | |||
| 54 | public getDiscount(): number { |
||
| 55 | return this.discount; |
||
| 56 | } |
||
| 57 | |||
| 58 | public getQuantity(): number { |
||
| 59 | return this.quantity; |
||
| 60 | } |
||
| 61 | |||
| 62 | public getBilling(): Billing { |
||
| 63 | return this.billing; |
||
| 64 | } |
||
| 66 |